<?php
/**
 * RedXenon Framework
 * 
 * LICENSE
 * 
 * This source file is subject to the New BSD license that is bundled
 * with this package in the file LICENSE.txt
 * A copy of this license can be found in the world-wide-web at this URL:
 * http://www.redxenon.com/license/new-bsd-license.txt

 * RedXenon Log (RXLog.php)
 * Class to manage log files across the different possible usages
 * 
 * @category RedXenon
 * @package RedXenon_Log
 * @copyright Copyright (c) 2011 Red Xenon (http://www.redxenon.com)
 * @version $Id: RXLog.php 1.0 2011-04-22 $ 
 */
class RXLog{

	var $logManager;
	
	public function __construct($path, $format, $maxFileSize = 1024000){
		switch($format){
			case "TXT":		require_once "RXLogManagerTXT.php";
									$this->logManager = new RXLogManagerTXT($path, $maxFileSize); 
									break;
			case "CSV":	require_once "RXLogManagerCSV.php";
									$this->logManager = new RXLogManagerCSV($path, $maxFileSize);
									break;
			default: 			throw new Exception("Format not applicable to a LogManager: ".$format);
		}
	}
	
	public function write($message, $file = null, $line = null){
		$this->logManager->write($message, $file, $line);
	}	
}

?>